package br.com.takashii.lp.web;

import java.util.ArrayList;
import java.util.List;

import br.com.caelum.vraptor.Get;
import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Resource;
import br.com.caelum.vraptor.Result;
import br.com.takashii.lp.domain.Cliente;


@Resource
public class ClientesController {

	
	private final Result result;

	public ClientesController(Result result) {
		this.result = result;
	}
	
	@Get
	@Path("/clientes")
	public void principal() {
		List<Cliente> clienteList = new ArrayList<Cliente>();
		
		int i = 1;
		while(i != 50){
			Cliente cliente = new Cliente();
			cliente.setNomeCliente("cliente"+i);
			clienteList.add(cliente);
			i++;
		}
		
		result.include("menuVisivel", true);
		result.include("titulo", "Lista de Clientes");
		result.include("clienteList", clienteList);
		result.forwardTo("/WEB-INF/jsp/clientes/form.jsp");
	}
	
}
